﻿ using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Portal.Web.Model;
using Portal.Core;

namespace Portal.Cms.Render
{
    public class WeeklySchedule
    {
        public static string GetPluginJavascript(string SiteId)
        {
            return AjaxWeeklyScheduleProcess.GetPlugInJavascript(SiteId);
        }


        public static AjaxOut Draw(string SiteId)
        {
            AjaxOut OAjaxOut = new AjaxOut();
            try
            {
                string RetHtml =
                   GetPluginJavascript(SiteId) +
                    "<input type=hidden id=\"txtPageIndex\" value=\"0\">\r\n" +
                    "<div id=divActionForm>\r\n" +

                    "</div>\r\n" +
                    "<div id=\"divMainForm\" style=\"display:block;\">\r\n" +
                    "   <div class=\"tabFunction\">Từ khóa: <input type=textbox class=textbox style=\"width:100px;\" id=txtKeyword>\r\n" +
                    "       <input onclick=\"javascript:ClientJumpPage(0);\" type=button value=\"Đọc lại\">" +
                    "       <input onclick=\"javascript:ClientShowFormAddWeeklySchedule();\" type=button value=\"Thêm mới\">" +
                    "   </div>" +
                    "   <div id=divProcessing></div>\r\n" +
                    "   <div id=\"divWeeklyScheduleContent\" class=\"tabcontent\">" +
                         AjaxWeeklyScheduleProcess.ServerSideReading(SiteId, "", "0").HtmlContent +
                    "   </div>" +
                    "</div>\r\n" +
                    "<input type=hidden id=\"txtWeeklyScheduleId\">\r\n" +
                    "<div id=divUpdateForm style=\"display:none;\">" + AjaxWeeklyScheduleProcess.ServerSideGetUpdateForm(SiteId).HtmlContent + "</div>\r\n";
                OAjaxOut.HtmlContent = RetHtml;
            }
            catch (Exception ex)
            {
                OAjaxOut.Error=true;
                OAjaxOut.InfoMessage = ex.Message.ToString();
                OAjaxOut.HtmlContent = ex.Message.ToString();
            }
            return OAjaxOut;
        }
    }
}
